#ifndef COMMON_H_INCLUDED
#define COMMON_H_INCLUDED

typedef unsigned char  uint8_t;
typedef unsigned short uint16_t;
typedef unsigned long  uint32_t;

typedef enum rule_action {
	RA_UNKNOWN,
	RA_PERMIT,
	RA_DROP,
} rule_action_t;

typedef struct rule_list {
	rule_action_t action;
	unsigned if_id;
	uint16_t ethertype;
	uint16_t proto;
	uint16_t port;
	struct rule_list *p_next;
} rule_list_t;

typedef struct packet_list {
	uint8_t *p_buffer;
	unsigned short buffer_len;
	struct packet_list *p_prev;
	struct packet_list *p_next;
} packet_list_t;

struct if_list2;
typedef struct if_list {
	unsigned ifid;
	const char *p_ifname;
	pcap_t *p_adhandle;
	char errbuf[PCAP_ERRBUF_SIZE];

	const rule_action_t *p_rule;

	struct if_list *p_next;

	packet_list_t *p_dont_send;
	struct if_list2 *p_others;
} if_list_t;

typedef struct handle_list {
	if_list_t *p_if_list;
	HANDLE handle;
	struct handle_list *p_next;
} handle_list_t;

typedef struct if_list2 {
	if_list_t *p_if_list;
	struct if_list2 *p_next;
	struct if_list2 *p_prev;
} if_list2_t;

#endif /* COMMON_H_INCLUDED */
